#ifndef FORTRESS_GLYPH_H
#define FORTRESS_GLYPH_H
#include "libtcod.hpp"
#include "eventhandler.h"
#include "engine.h"

#include "serialization.h"

namespace fortress
{
	class map;

	class glyph : public eventReceiver
	{
		friend class boost::serialization::access;
		template<class Archive>
		void serialize(Archive & ar, const unsigned int version);

		friend void fortress::Engine::updateWorld(bool playerTurn);
		char display;	// Character displayed for the player
		TCODColor_S color;	// Color the character is displayed
		int x;		// X position on the map
		int y;		// Y position on the map

	protected:
		map * currentMap;
		
	public:
		glyph & operator=(glyph const & copy);
		char getGlyph() const;
		TCODColor getColor() const;
		void getCoords(int &x, int &y) const;
		void setGlyph(char newGlyph);
		void setColor(TCODColor newColor);
		// Used to send input commands to the object.
		virtual bool exec(int, int);
		virtual void message(std::string const & message) { };
		virtual bool doEvent(eventStructure const & sent) { return 0; };
		// Sets x/y coordinates
		void setCoords(int,int);
		void setMap(map * newMap);
		bool isOnMap(map * compareMap) const;
		bool isOnMap(glyph * compareGlyph) const;
		glyph();
		virtual ~glyph();
	};
};


#endif